using UnityEngine;

public class EloRankButton : MonoBehaviour
{
	public UILabel rankLabel;

	public void OnEnable()
	{
		UpdateDisplay();
		BehaviourSingleton<GGNotificationCenter>.instance.onMessage -= OnMessageDelegate;
		BehaviourSingleton<GGNotificationCenter>.instance.onMessage += OnMessageDelegate;
	}

	public void OnDisable()
	{
		BehaviourSingleton<GGNotificationCenter>.instance.onMessage -= OnMessageDelegate;
	}

	private void OnMessageDelegate(string message)
	{
		if ("MessageConflictResolved".Equals(message))
		{
			UpdateDisplay();
		}
	}

	private void UpdateDisplay()
	{
		LevelSystem.CurrentDefinedPointLevelInfo currentDefinedPointLevelInfo = LevelSystem.instance.CurrentPlayerLevel();
		string @string = ScriptableObjectSingleton<SettingsUI>.instance.GetString("Rating");
		rankLabel.text = @string + ": " + GGPlayerSettings.instance.GetDisplayEloRating().ToString();
	}
}
